/*
 * @Description:
 * @Version:
 * @Author: Troubadour
 * @Date: 2022-07-09 07:56:48
 * @LastEditors: Troubadour
 * @LastEditTime: 2022-07-10 00:37:59
 */


#include "FMQ.h"



/**
 * @function: FMQ_OFF
 * @description: 关闭蜂鸣器
 * @param {*}
 * @return {*}
 */
void FMQ_OFF(void)
{
    HAL_GPIO_WritePin(FMQ_PORT, FMQ_PIN, GPIO_PIN_RESET);
}

/**
 * @function: FMQ_ON
 * @description: 打开蜂鸣器
 * @param {*}
 * @return {*}
 */
void FMQ_ON(void)
{
    HAL_GPIO_WritePin(FMQ_PORT, FMQ_PIN, GPIO_PIN_SET);
}

/**
 * @function: FMQ_TOGGLE
 * @description: 翻转蜂鸣器状态
 * @param {*}
 * @return {*}
 */
void FMQ_TOGGLE(void)
{
    HAL_GPIO_TogglePin(FMQ_PORT, FMQ_PIN);
}

void FMQ_Alarm(double *value)
{
    if(*value < FMQ_ALARM_VALUE)
    {
        FMQ_ON();
    }
    else
    {
        FMQ_OFF();
    }
}

